<extend name="Common@Layout:layui-admin" />
<block name="title">
    <title>编辑用户</title>
</block>
<block name="style">
    <style>
        .layui-fixbar {
            display: none;
        }
    </style>
</block>

<block name="main">
    <div class="layui-main" style="width:auto">
        <form class="layui-form close-dialog" action="{:U('edit_post')}" method="post" style="margin-top:20px;">
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">用户名：</label>
                    <div class="layui-input-inline">
                        <input type="tel" name="username" value="{$info.username}" placeholder="必填" lay-verify="required" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">手机：</label>
                    <div class="layui-input-inline">
                        <input type="text" name="mobile" value="{$info.mobile}" placeholder="必填" lay-verify="required phone" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">邮箱：</label>
                    <div class="layui-input-inline">
                        <input type="text" name="email" value="{$info.email}" placeholder="必填" lay-verify="email" autocomplete="off" class="layui-input">
                    </div>
                </div>
           
            </div>

            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">真实姓名：</label>
                    <div class="layui-input-inline">
                        <input type="tel" name="realname" value="{$info.realname}" lay-verify="realname" autocomplete="off" class="layui-input">
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">昵称：</label>
                    <div class="layui-input-inline">
                        <input type="text" name="nickname" value="{$info.nickname}" lay-verify="nickname" autocomplete="off" class="layui-input">
                    </div>
                </div>
            </div>
		
            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">用户角色：</label>
                    <div class="layui-input-inline">
                        <php>
                            $roles = D('AuthGroup')->getField('group,title');
                        </php>
                        <select name="role" lay-verify="required">
														<foreach name="roles" item="vo" key="k">
															<option value="{$k}" <if condition="$info['role'] eq $k">selected</if>>{$vo}</option>	
														</foreach>
												</select>
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">设置密码：</label>
                    <div class="layui-input-inline">
                        <input type="text" name="password" style="width:2-0px;" value="" autocomplete="off" class="layui-input">
                    </div>
                    <div class="layui-form-mid layui-word-aux">创建用户时，如果不设置密码，默认密码为123456</div>
                </div>

            </div>

            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label">是否启用：</label>
                    <div class="layui-input-block">
                        <input type="checkbox" name="status" value="1" lay-text="ON|OFF" <if condition="$info.status eq 1">checked</if> lay-skin="switch">
                    </div>
                </div>
                 <div class="layui-inline">
                    <label class="layui-form-label">等级：</label>
                    <div class="layui-input-inline">
                        <input type="text" name="level" value="{$info.level}"  autocomplete="off" class="layui-input">
                    </div>
                </div>
                
            </div>

            <div class="layui-form-item">
                <div class="layui-input-block">
                    <input type="hidden" name="uid" value="{$info.uid}">
                    <button class="layui-btn" lay-submit lay-filter="*">立即提交</button>
                </div>
            </div>
        </form>
    </div>
</block>


<block name="script">
    <script>
        layui.use(['jquery'], function() {
            var $ = layui.jquery;
            $('#saveBtn').click(function() {
                $('#jsonInput').val(JSON.stringify(editor.get()));
                layui.miniweb.formSubmit($('form'));
            });
        });
    </script>
</block>